KISSY.use("node",function(S,Node){ 
	$(".js-zidong").on("click",function(){
		var ac = $(this).attr("data-ac");
		if(ac=="close"){
			showDialog("确认关闭","<center>关闭后系统将不能获取您的订单，一定要关闭吗？<br /><button class=\"button button-danger js-close\">关闭</button> <button class=\"button button-info js-cancel\">取消</button></center>","well");
			$(".js-close").on("click",function(){
				closeautoorder("close");
			});
			$(".js-cancel").on("click",function(){
				closeDialog();
			});
			$(".cancel").remove();
		}else{
			closeautoorder("open");
		}
	});

function closeautoorder(ac){
KISSY.io({
	"url":"/?m=shopadmin&a="+ac,
	"success":function(data){
		closeDialog();
		if(data.status==true){
			if(ac=="open"){
				$(".js-zidong").attr("data-ac","close");
				$(".js-zidong").attr("src","http://img01.taobaocdn.com/imgextra/i1/27390555/TB21LY6aFXXXXXKXpXXXXXXXXXX_!!27390555-2-tae.png_160x160.jpg")
			}else{
				$(".js-zidong").attr("data-ac","open");
				$(".js-zidong").attr("src","http://img04.taobaocdn.com/imgextra/i4/27390555/TB2.2QaaFXXXXXwXXXXXXXXXXXX_!!27390555-2-tae.png_160x160.jpg")
			}
		}else{
			showDialog("操作失败","自动订单服务操作失败，原因如下："+data.msg+"请联系管理员。","well");
		}
	},
	"false":function(){
		alert("error");
	},
	"dataType":"jsonp"
});
return false;
}
});
